iOS - UISlider - How to make a slider to auto-move [closed]
Posted
by
drodri420
on Programmers
See other posts from Programmers
or by drodri420
Published on 2012-10-25T13:20:25Z
Indexed on
2012/10/25
17:12 UTC
Read the original article
Hit count: 225
its me again.
Coming back with another noobish question:
This time its , can you make a UISlider move by itself???
I've implemented this on the .m
///This right here makes a slider move 1point from 1 to 100, once it reaches 100 it goes backwards and so on...
- (IBAction)moveSlider:(UISlider *)sender
{
int flag=0, counter=1;
while(flag == 0)
{
counter = counter + (.25 * round);
if(counter == 100)
{
flag = 1;
}
if(counter < 100 && counter > 1)
{
slider.value = counter;
}
}
while(flag == 1)
{
counter = counter - (.25 * round);
if(counter == 1)
{
flag = 0;
}
if(counter < 100 && counter > 1)
{
slider.value = counter;
}
}
}
And Implemented this on another action:
-(void)startNewRound
{
round+=1;
targetValue = 1 + (arc4random() % 100);
self.slider.value = currentValue;
[self moveSlider:slider];
}
I think I lost it along the way and Im just typing pure nonsense but If anyone could point me in the right direction on to which is it that Im doing wrong??
© Programmers or respective owner